function goods_save() {
    ajaxRequest(getHost() + "/goods/goodsAddEdit/save",
            {"GoodsCode" : getValue("txtGoodsCode"),
             "GoodsName" :getValue("txtGoodsName"),
             "goodsFirstCATG" :getSelectedValue("goodsFirstCATG"),
             "goodsSecondCATG" :getSelectedValue("goodsSecondCATG"),
             "Variation" :getValue("txtVariation"),
             "SellPrice" :getValue("txtSellPrice"),
             "StockNum" :getValue("txtStockNum")},
             goods_saveCallBack);
}
function goods_saveCallBack(data) {
    document.goodsAddEditForm.action = getHost() +"goods/goodsList/index/insertFg/1";
    document.goodsAddEditForm.submit();
}
function goods_edit() {
    ajaxRequest(getHost() + "/goods/goodsAddEdit/update",
            {"GoodsCode" : getValue("txtGoodsCode"),
             "GoodsNo" : getValue("hidGoodsNo"),
             "GoodsName" :getValue("txtGoodsName"),
             "goodsFirstCATG" :getSelectedValue("goodsFirstCATG"),
             "goodsSecondCATG" :getSelectedValue("goodsSecondCATG"),
             "Variation" :getValue("txtVariation"),
             "SellPrice" :getValue("txtSellPrice"),
             "StockNum" :getValue("txtStockNum")},
             goods_editCallBack);
}
function goods_editCallBack(data) {
    document.goodsAddEditForm.action = getHost() +"goods/goodsList/index/updateFg/1";
    document.goodsAddEditForm.submit();
}
function goods_supplier() {
    ajaxRequest(getHost() + "/goods/goodsAddEdit/setsession",
            {"GoodsCode" : getValue("txtGoodsCode"),
             "GoodsNo" : getValue("hidGoodsNo"),
             "GoodsName" :getValue("txtGoodsName"),
             "goodsFirstCATG" :getSelectedValue("goodsFirstCATG"),
             "goodsSecondCATG" :getSelectedValue("goodsSecondCATG"),
             "Variation" :getValue("txtVariation"),
             "SellPrice" :getValue("txtSellPrice"),
             "StockNum" :getValue("txtStockNum")},
             goods_supplierCallBack);
}
function goods_supplierCallBack() {
    var addEditFg = getValue("hidAddEditFg");
    document.goodsAddEditForm.action = getHost() +"goods/goodsWithSupplier/index/addEditFg/" + addEditFg;
    document.goodsAddEditForm.submit();
}
function goods_delete() {
    ajaxRequest(getHost() + "/goods/goodsAddEdit/delete",
            {"GoodsNo" : getValue("hidGoodsNo")},
            goods_deleteCallBack);
}
function goods_deleteCallBack() {
    document.goodsAddEditForm.action = getHost() +"goods/goodsList/index/DeleteFg/1";
    document.goodsAddEditForm.submit();
}
function goods_back(strGoodsNo) {
    ajaxRequest(getHost() + "/goods/goodsAddEdit/removesession",
            {"strGoodsNo" :strGoodsNo},
        goods_backCallBack);
    
}
function goods_backCallBack(strGoodsNo) {
    if(getValue("hidAddEditFg") == 1) {
        document.goodsAddEditForm.action = getHost() +"goods/goodsList/index";
        document.goodsAddEditForm.submit();
    } else {
        document.goodsAddEditForm.action = getHost() +"goods/goodsDetails/index/goodsNo/"+ strGoodsNo;
        document.goodsAddEditForm.submit();
    }
}